<?php
// +----------------------------------------------------------------------
// | Jqcms [ Avenue to Jane ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017 http://jqcms.net All rights reserved.
// +----------------------------------------------------------------------
// | Author: hyacinth <845077398@qq.com>
// +----------------------------------------------------------------------
namespace Admin\Model;
use Think\Model;

class CategoryModel extends Model{
    
    protected $_map = array(
          
            'parent' => 'parent_id',//字段映射
            
    );
    
    protected $_validate =array(
        array('name','require','名称不能为空!'),
        array('name','','分类已存在！',0,'unique',1), 
    );
    
    public function dateline(){
        
        $dateline = strtotime($_POST['dateline']);
            
        return $dateline;
        
    }
    
    public function getCate(){
        
        $list = $this->order(array('parent_id'=>'asc'))->select();
        $data = list_to_tree($list,'id','parent_id');
        return $data;
        
    }
    
    
     
    
}